package com.edu.lxshpc.controller;

import com.edu.lxshpc.utils.MyException;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zgh
 * @date 2023/12/7
 */
@RestController
@RequestMapping("/error")
@Slf4j
public class FilterExceptionController {
    @PostMapping("/jwtFilter")
    public void jwtFilterException(HttpServletRequest request) throws Exception {
        MyException e = (MyException) request.getAttribute("jwtFilter.error");
        log.warn(e.getMessage());
        throw e;
    }
}